<template>
    <div>
        <div class="conter">
        <div class="box" v-for="(value,index) in val" :key="index" @click="details(value.id)">
          <img :src="value.recipesImage" />
          <p>{{value.recipesName}}</p>
          <span>{{value.browseCount}}浏览  {{value.collectCount}}收藏</span>
        </div>
    </div>
    </div>
</template>

<script>
    export default {
        props:['val'],
        methods: {
          details(id){
            this.$router.push(`/details/${JSON.parse(sessionStorage.getItem('user')).id}/${id}`)
          }
        },
    }
</script>

<style lang="scss" scoped>
.conter{
  width: 100%;
  .box{
      display: inline-block;
      width: 40%;
      margin: 10px 15px 0 15px;
      height: 200px;
      img{
          width: 100%;
          height: 60%;
      }
      p{
          text-align: center;
          margin-top: 2px;
          margin-bottom: 2px;
          font-weight: 600;
      }
      span{
          font-weight: 200;
          color: #ccc;
      }
  }
}
</style>